import {
  Slider,
  Input, Switch, Color, Select, Radio
} from '@/components/CustomPage/fields/widget'

export function swiperOption() {
  return [
    {
      type: Switch,
      option: {
        label: '是否显示指示器',
        name: 'indicators',
        value: true,
        activetext: '是',
        inactivetext: '否'
      }
    },
    {
      type: Switch,
      option: {
        label: '是否自动轮播',
        name: 'isAutoPlay',
        value: true,
        activetext: '是',
        inactivetext: '否',
        override: function(ths, e) {
          ths.$nextTick(() => {
            for (let i = 0; i < ths.$parent.$parent.$children.length; i++) {
              if (ths.$parent.$parent.$children[i].option.name === 'delayTime') {
                ths.$parent.$parent.$children[i].visible = e
              }
            }
          })
        }
      }
    },

    { type: Input, option: { label: '自动轮播时间（秒）', value: 5, name: 'delayTime' }}
  ]
}

/**
 * 没有指示器的轮播设置
 */
export function swiperNoIndicatorsOption() {
  return [
    {
      type: Switch,
      option: {
        label: '是否自动轮播',
        name: 'isAutoPlay',
        value: true,
        activetext: '是',
        inactivetext: '否',
        override: function(ths, e) {
          ths.$nextTick(() => {
            for (let i = 0; i < ths.$parent.$parent.$children.length; i++) {
              if (ths.$parent.$parent.$children[i].option.name === 'delayTime') {
                ths.$parent.$parent.$children[i].visible = e
              }
            }
          })
        }
      }
    },

    { type: Input, option: { label: '自动轮播时间（秒）', value: 5, name: 'delayTime' }}
  ]
}
